{extend name="adminheader:header"/}
{block name="content"}
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商品分类列表</h5>
                    </div>
                    <div class="ibox-content">
                        <form action="{:url('/admin/Category/index')}" method="post" role="form" class="form-inline" style="padding-bottom:30px;">
                            分类名: <input type="text" name="name" value="{$name|default=''}" placeholder="请输入分类名" style="width:200px;" class="form-control" />&nbsp;&nbsp;
                            <input type="submit" class="btn btn-success" value="搜索" style="margin-bottom: 0;"/>
                            <a class="btn btn-danger" href="{:url('/admin/Category/index')}">清空</a>
                        </form>
                        <div class="table-responsive">
                            <table class="table table-striped table-hover ">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>分类名</th>
                                        <th>父类ID</th>
                                        <th>分类路径</th>
                                        <th>分类图</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {if condition="$list neq null"}
                                        {volist name="list" id="vo"}
                                       		<tr>
        	                                    <td>{$vo.id}</td>
        	                                    <td>{$vo.name}</td>
        	                                    <td>{$vo.pid}</td>
        	                                    <td>{$vo.path}</td>
                                                {if condition="$vo['pid'] eq 0"}
                                                    <td></td>
                                                {else/}
                                                    <td><img src="{:getPreviewUrl($vo.pic)}" width="50" height="50"  onclick="imagePreviewDialog(this.src);" style="cursor: pointer;"/></td>
                                                {/if}
                                                
        	                                    <td>
                                                    {if condition="$vo['pid'] eq 0"}
        	                                    	  <a href="{:url('/admin/Category/addChild',array('id'=>$vo['id'],'path'=>$vo['path'],'name'=>$vo['name']))}" class="btn btn-success">添加子类</a>
                                                    {else/}
                                                        <p disabled="disabled" class="btn btn-default">添加子类</p>
                                                    {/if}
                                                    {if condition="$vo['pid'] eq 0"}
                                                      <a href="{:url('/admin/Category/edit',array('id'=>$vo['id']))}" class="btn btn-primary">编辑</a>
                                                    {else/}
                                                       <a href="{:url('/admin/Category/editChild',array('id'=>$vo['id']))}" class="btn btn-primary">编辑</a>
                                                    {/if}
        	                                        <a href="{:url('/admin/Category/delete',array('id'=>$vo['id']))}" class="btn btn-danger js-ajax-delete">删除</a>
        	                                    </td>
        	                                </tr>
                                        {/volist}
                                    {else/}
                                        <tr>
                                            <td style="font-size:20px;text-align:center">暂无数据</td>
                                        </tr>
                                    {/if}
                                </tbody>
                            </table>
                            <div class="text-right pages">
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="/admin/js/admin.js"></script>
{/block}